home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_pru_fallingdebris.cog < prev    next >
Text File  |  1999-11-15  |  3KB  |  86 lines

  1.  
  2. # Jones 3D Cog Script
  3. #
  4. # PRU_FallingDebris.cog
  5. #
  6. # debris = place a ghost object in the center of your room and put it near the ceiling.
  7. # clutter = place a ghost object in the center of the room at floor level.
  8. #
  9. # turn on this cog from another cog with SendMessage(cogname, user0);
  10. # turn off this cog from another cog with SendMessage(cogname, user1);
  11. #
  12. # [TRM] [GGJ]
  13. #
  14. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  15. # ========================================================================================
  16.  
  17. symbols
  18.  
  19.     message     user0
  20.     message     user1
  21.     message     pulse
  22.     message     timer
  23.     
  24.     thing       debris              # the junk that falls
  25.     
  26.     thing       rocks               local
  27.     
  28.     sector      tempSect            local
  29.     
  30.     sound       sndFalling=olv_fallfloor_c.wav  local   # falling rocks
  31.     
  32.     template    debris0=stnshrapas_nc_ns         local   
  33.     template    debris1=stnshrapbs_nc_ns        local   
  34.     template    debris2=stnshrapcs_nc_ns        local 
  35.     
  36.     vector      vecPos              local
  37.     vector      rocksVel            local
  38.     
  39.     int         deb                 local
  40.     int         sound1              local
  41.  
  42.     flex        xVal                # x = width of room
  43.     flex        yVal                # y = length of room
  44.     flex        pulseTime=0.5        # duh
  45.     
  46. end
  47.  
  48. # ========================================================================================
  49. code
  50.  
  51. user0:
  52.  
  53.     SetPulse(pulseTime);
  54.     sound1 = PlaySoundThing(sndFalling, debris, 1.0, -1, -1, 0x880);
  55.     return;
  56.     
  57. # ========================================================================================
  58.  
  59. user1:
  60.  
  61.     SetPulse(0.0);
  62.     StopSound(sound1, 0.0);
  63.     return;
  64.  
  65. # ========================================================================================
  66.  
  67. pulse:
  68.     tempSect = GetThingSector(debris);
  69.     
  70.     SetPulse(0.0);
  71.     for(deb=0; deb<RandBetween(3, 5); deb=deb+1)                                                                        
  72.     {                                                                                                    
  73.         vecPos = VectorSet(rand()*xVal, rand()*yVal, 0.0);
  74.         rocks = CreateThingAtPos(debris0[RandBetween(0, 2)], tempSect, VectorAdd(GetThingPos(debris), VectorAdd('-0.25 -0.25 0.0', vecPos)), '0 0 0');
  75.         rocksVel = VectorSet(0, 0, 0.01);
  76.         SetThingVel(rocks, VectorScale(rocksVel, 0.7));
  77.     }
  78.     SetPulse(pulseTime);
  79.     
  80.     return;
  81.  
  82. # ========================================================================================
  83.  
  84. end
  85.  
  86.